package com.woniu108.valueAdded.client;


import com.woniu108.carService.commos.dto.UserInfoDto;
import com.woniu108.carService.commos.model.Result;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name="person-server",path = "/person")
public interface PersonClient {
//通过接口文档调用服务接口获得result


    /**
     * 根据id查找单个用户
     * @param userId 用户ID
     * @return UserInfoDto 用户详细信息
     */
    @GetMapping("/userInfo/getByUserId/{userId}.c")
    public Result<UserInfoDto> getByUserId(@PathVariable("userId")String userId);
    /**
     * 用户积分增加
     * @param userId 用户ID
     * @param score 变动积分
     * @return newScore 变动后积分
     */
    @GetMapping("/userInfo/addUserScore.c")
    public Result<Integer> addUserScore(@RequestParam("userId") String userId, @RequestParam("score") Integer score,@RequestParam("scoreType")Integer scoreType);

    /**
     * 用户积分减少
     * @param userId 用户ID
     * @param score 变动积分
     * @return newScore变动后积分
     */
    @GetMapping("/userInfo/reduceUserScore.c")
    public Result<Integer> reduceUserScore(@RequestParam("userId") String userId, @RequestParam("score")Integer score,@RequestParam("scoreType")Integer scoreType);
    /**
     * 更新用户优惠券信息
     * @param userId 用户ID
     * @param details 用户优惠券信息(JSON)
     * @return result 接口是否正常访问到结果
     */
    @GetMapping("/userInfo/updateTicketDetails.c")
    public Result updateTicketDetails(@RequestParam("userId")String userId,@RequestParam("details")String details);

    /**
     * 添加管理员操作历史记录
     * @param adminId 管理员编号
     * @param methodName 操作功能名称
     * @return result 是否正常访问接口结果
     */
    @GetMapping("/adminHistory/addAdminHistory.api")
    @ApiOperation("添加管理员操作历史记录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "adminId",value = "管理员编号"),
            @ApiImplicitParam(name = "methodName",value = "操作功能名称")
    })
    public Result addAdminHistory(@RequestParam("adminId") String adminId,@RequestParam("methodName") String methodName);
}
